<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Socket.io Basic</title>
	<script src='/socket.io/socket.io.js'></script>
	<script>
		window.onload = function() {
			// create socket
			var socket = io.connect();
			
			// register socket event handler
			socket.on('response', function(data) {
				alert(data);
			});
			
			// register echo event handler
			document.getElementById('echo').onclick = function() {
				var text = document.getElementById('text').value;

				// send data
				socket.emit('send', text);
			};
		};		
	</script>
</head>
<body>
	<input type='text' id='text'/>
	<input type='button' id='echo' value='echo'/>
</body>
</html>